﻿/*  ----------------------------------------------------------------------------
 *  SysServer
 *  ----------------------------------------------------------------------------
 *  File:       TEntity.cs
 *  Creater:     SEEN\MistSeen
 *  ----------------------------------------------------------------------------
 *  $Date: 2010-09-06 10:36:01 +0000 (Mon, 06 Sep 2010) $
 *  $Rev: 15 $
 *  $Author: ScorDeity $
 *  $URL: http://sysserver.googlecode.com/svn/trunk/src/SysServer/Collections/TEntity.cs $
 *  $Id: TEntity.cs 15 2010-09-06 10:36:01Z ScorDeity $
 */

using System;

namespace SysServer.Collections
{
    /// <summary>
    /// 带锁的实体类
    /// </summary>
    public class TEntity
    {
        /// <summary>
        /// 
        /// </summary>
        internal object LinkedEntity;
        /// <summary>
        /// 
        /// </summary>
        public TEntity()
        {
            Initialize();
        }
        /// <summary>
        ///  Called when a poolable entity is being returned from the pool to caller
        /// </summary>
        public virtual void Initialize()
        {
            this.LinkedEntity = null;
        }

        /// <summary>
        ///  Called when a poolable entity is being returned back the pool to caller
        /// </summary>
        public virtual void UnInitialize()
        {
            this.LinkedEntity = null;
        }
    }


    /// <summary>
    /// creates new poolable entity from factory
    /// </summary>
    public abstract class TEntityFactory
    {
        /// <summary>
        ///  Create a new instance of a poolable entity
        /// </summary>
        /// <returns>Instance of user defined PoolableEntity derived type</returns>
        public abstract TEntity CreateTEntiy();
    }      
}